//
//  CWSportMapTypeVC.m
//  大神专制黑马行
//
//  Created by chenWei on 2017/5/15.
//  Copyright © 2017年 陈伟. All rights reserved.
//

#import "CWSportMapTypeVC.h"

@interface CWSportMapTypeVC ()

//记录上一次点击按钮
@property(nonatomic, weak) UIButton *lastButton;

@end

@implementation CWSportMapTypeVC

- (void)viewDidLoad {
    [super viewDidLoad];
    
    //程序启动默认选中下标为0的地图样式
    
    //获取视图
    UIButton *button = [self.view viewWithTag:1];
    button.selected = YES;
    self.currentIndex = button.tag;
    
}

#pragma mark - 地图模式选择
- (IBAction)sportMapModeButtonClick:(UIButton *)sender {
    //判断当前点击与上一次点击是否为同一个
    if (self.lastButton == sender) {
        return;
    }
    
    //1.先取消上一次的点击
    self.lastButton.selected = NO;
    //2.设置当前点击按钮为选中状态
    sender.selected = YES;
    //3.记录当前点击按钮
    self.lastButton = sender;
    
    
    if (self.block) {
        //把按钮的 tag 值传出去
        self.block(sender.tag);
    }
}




- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
